﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>用户登录</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    
    <script src="../lib/jquery/1.9.1/jquery.js"></script>
    <script src="../lib/jquery/jquery.form.js"></script>
    <link href="../lib/layui/css/layui.css" rel="stylesheet" media="all" />
</head>
<body class="childBody" style="padding-top: 30px;">
    <form class="layui-form" id="form1">
        <div class="layui-form-item">
            <label class="layui-form-label">账号<span style="color:red;">*</span></label>
            <div class="layui-input-inline layui-input-txt" style="width:190px">
                <input type="text" name="UserName" id="txtUserName" required lay-verify="required" placeholder="请输入账号" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">密码<span style="color:red;">*</span></label>
            <div class="layui-input-inline layui-input-txt" style="width:190px">
                <input type="password" name="ADAccount" id="txtADAccount" required lay-verify="pass" placeholder="请输入密码" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <input type="button" class="layui-btn" lay-submit lay-filter="*" onclick="login()" value="登 录" />
                <button type="button" class="layui-btn layui-btn-primary" onclick="Cancel()">取 消</button>
            </div>
        </div>
    </form>
</body>
</html>

<script src="../lib/layui/layui.js"></script>
<script src="../lib/Common.js"></script>

<script type="text/javascript">
    var form = null;
    layui.use('form', function () {
        form = layui.form;
    });
    var layer = null;
    layui.use('layer', function () {
        layer = layui.layer;
    });

    function login() {
        form.on('submit(*)', function (data) {
            var loadIndex = layer.load(2);
           $.ajax({
             type: "post",
             url: confogurl+"/Login/Login",
             data: {usercode:$("#txtUserName").val(), userpow:$("#txtADAccount").val()},
             dataType: "text",
             success: function(data){
                layer.close(loadIndex);
                if (data.indexOf("error") == -1) {
                    layer.msg('登录成功!');
                    parent.admin(data);
                } else {
                    layer.msg(data)
                }
             }  ,
             error:function(er)
             {
                layer.close(loadIndex);
                alert(er);
             }    
            });
        });
    }
</script>
